<?php
/*
 Author: Mr.Tien
 Function: Captcha
 */

session_start();
session_unregister('ma_xac_nhan');
$str = rand(100000,999999);
$_SESSION['ma_xac_nhan'] = $str;
$img = imagecreatefromjpeg("captcha1.jpg");

$textColor = imagecolorallocate($img, 255, 255, 255);
imagestring($img, 5, 12, 6, $_SESSION['ma_xac_nhan'], $textColor);
$lineColor = imagecolorallocate($img,233,239,239);
imageline($img,70,10,5,20,$lineColor);

header("Content-type: image/jpeg");
imagejpeg($img);